package LeetCode;

public class LC_206_ReverseLinkedList {

    public static void main(String[] args) {

    }

    static class Solution {
        public static ListNode reverseList(ListNode head) {
            if (head == null || head.next == null) return head;
            ListNode fakeNode = new ListNode(-1);
            fakeNode.next = head;
            ListNode cur = head.next;
            head.next = null;
            while (cur != null) {
                ListNode nextcur = cur.next;
                cur.next = fakeNode.next;
                fakeNode.next = cur;
                cur = nextcur;
            }
            return fakeNode.next;
        }
    }

}